package com.zimin.common.exception;

import com.zimin.shared.enums.ResponseStatusEnum;

/**
 * 自定义异常，用于返回前端信息
 *
 * @author : zimin
 * @since : 2021/6/24 3:30 下午
 */
public final class InjectException extends RuntimeException {

    private String msg;
    private Integer code;
    private ResponseStatusEnum responseStatusEnum;

    public InjectException(String msg) {
        super("具体的异常信息为:" + msg);
        this.msg = msg;
    }

    public InjectException(ResponseStatusEnum responseStatusEnum) {
        this.responseStatusEnum = responseStatusEnum;
        this.code = responseStatusEnum.status();
        this.msg = responseStatusEnum.msg();
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public ResponseStatusEnum getResponseStatusEnum() {
        return responseStatusEnum;
    }

    public void setResponseStatusEnum(ResponseStatusEnum responseStatusEnum) {
        this.responseStatusEnum = responseStatusEnum;
    }
}
